package cn.itcast.listen;

import cn.itcast.conf.MqConstants;
import cn.itcast.searchService.SearchService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.Set;

@Component
public class ItemListener {
    @Autowired
    private SearchService searchService;

    @RabbitListener(queues = MqConstants.Item_DELETE_QUEUE)
    public void deleteById(Long  id){
        System.out.println("接收到删除通知"+id);
        searchService.deleteById(id);
    }


    @RabbitListener(queues = MqConstants.Item_INSERT_QUEUE)
    public void insert(long[] arr){

        searchService.setStatus(arr);
    }

}
